<?php
// 数据库操作
// 连接数据库
$link=mysqli_connect("localhost","root","root","2113");
$username=$_GET['username'];
$gender = $_GET['gender'];
$age = $_GET['age'];
$sql="INSERT INTO student (username,gender,age) VALUES ('$username','$gender',$age)";
$res=mysqli_query($link,$sql);
if(mysqli_affected_rows($link)){//查看sql是否有影响的行数；
// echo "<script>alert('添加成功');window.location.href='index.php';</script>";	
$info['status']=1;
$info['data']="添加成功";
}else{
$info['status']=0;
$info['data']="添加失败";
}
echo json_encode($info);
?>